﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <title>Title</title>
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
    <script src="${ctx}/common/plugins/jquery-1.10.2.min.js"></script>
</head>
<body>
<form class="layui-form" action="${ctx}/productClassify/${action}">
    <input type="hidden" name="id" id="classifyId" value="${entity.id}"/>
     <div class="layui-form-item layui-col-md5" style="margin-top: 50px">
        <label class="layui-form-label">父级类别</label>
        <div class="layui-input-block">
            <input type="hidden" name="tPorCla" id="t_por_cla"  value="${entity.tPorCla}" class="layui-input">
            <input readonly id="personCla" lay-type="showPerson" value="${personEntity.name}" placeholder="请选择父级类别" class="layui-input">
            <button style="position: absolute;right: -112px;margin-top: -38px;" type="button" id="clearPerson" class="layui-btn layui-btn-primary">清空父类</button>
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">类别名称<span style="color: red">*</span></label>
        <div class="layui-input-block">
            <input type="text" name="name" value="${entity.name}"
                   lay-verify="required"placeholder="请输入产品类别名称" autocomplete="on"
                class="layui-input">
        </div>
    </div>
   <%--  <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">编号<span style="color: red">*</span></label>
        <div class="layui-input-block">
            <input type="text" name="code" value="${entity.code}"
                   lay-verify="required" placeholder="请输入产品类别编号" autocomplete="on"
                class="layui-input" onKeyUp="value=value.replace(/[^\d|chun]/g,'')">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <input type="text" name="described" value="${entity.described}"
                   placeholder="请输入描述信息" autocomplete="on"
                class="layui-input">
        </div>
    </div> --%>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="formBtn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="button" id="rollback" class="layui-btn layui-btn-primary">返回</button>
        </div>
    </div>
</form>
<script>
    //Demo
    var form = null;
    layui.use('form', function () {
        form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.load(1, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            return true;
        });
    });

    document.getElementById("personCla").addEventListener("click", function () {
        layer.open({
            type: 2,
            skin: 'layui-layer-rim', //加上边框
            area: ['30%', '80%'], //宽高
            content: '${ctx}/productClassify/queryProCla'
        });
        form.render();
    })
    
    document.getElementById("clearPerson").addEventListener("click", function () {
    	document.getElementById("t_por_cla").value="";
    	document.getElementById("personCla").value="";
    })
    document.getElementById("rollback").addEventListener("click",function(){
        window.history.back();
    })
</script>
</body>
</html>



